Skip to content

Clarify scipy linprog transformation description#742

Open
Zhengyizhe0209-arch wants to merge 1 commit into
QuantEcon:mainfrom
Zhengyizhe0209-arch:patch-2
Open

Clarify scipy linprog transformation description#742
Zhengyizhe0209-arch wants to merge 1 commit into
QuantEcon:mainfrom
Zhengyizhe0209-arch:patch-2

Conversation

@Zhengyizhe0209-arch
Copy link
Copy Markdown

Addresses #599.

This PR makes the description of scipy.optimize.linprog more precise by noting that SciPy transforms the problem into standard form internally after presolve.

Clarifies that SciPy transforms the problem into standard form internally after presolve.
@netlify
Copy link
Copy Markdown

netlify Bot commented May 18, 2026

Deploy Preview for taupe-gaufre-c4e660 ready!

Name Link
🔨 Latest commit 7dbf34c
🔍 Latest deploy log https://app.netlify.com/projects/taupe-gaufre-c4e660/deploys/6a0b0112ab034f0008a52a6b
😎 Deploy Preview https://deploy-preview-742--taupe-gaufre-c4e660.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@HumphreyYang
Copy link
Copy Markdown
Member

Many thanks @Zhengyizhe0209-arch! It's a nice PR.

I think the wording should be a bit more specific because the lecture calls linprog without setting method, so SciPy uses the default method='highs'.

In SciPy, highs is an interface to the HiGHS optimization solver, and it automatically chooses between the HiGHS dual simplex solver and the HiGHS interior-point solver.

Because of this, I would avoid saying that SciPy necessarily converts the problem to standard form by adding slack variables before solving, since that description is mainly tied to the legacy linprog methods.

I think this is also the point that is being raised in #599.

A simpler replacement could be:

SciPy accepts inequality constraints in the form $A_{ub} x \leq b_{ub}$, equality constraints in the form $A_{eq} x = b_{eq}$, and variable bounds.

In this lecture, linprog uses SciPy’s default highs method, which calls the HiGHS optimization solver.

The slack value returned by linprog is a one-dimensional NumPy array whose entries measure the difference $b_{ub} - A_{ub}x$ for each inequality constraint.

Another small comment: you noted that this PR addresses #599, but it only tackles the first part of the issue.

It would be nice to address the entire issue in one PR or explicitly state that it addresses the first or second part of the issue to avoid closing it without fully resolving it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants